<extend name="Public/common" />
<block name="style">	
	<link rel="stylesheet" href="__STATIC__/uploadify/portrait.css" type="text/css" /> 
</block>
<block name="content">
<div class="row">
	<div class="col-md-10 col-md-offset-1 m-b-md m-t-md">
		<div class="panel panel-default">
			<div class="panel-heading">
				<ul class="nav nav-tabs pull-right">
					<li class="active"><a data-toggle="tab" href="#space-bg">背景</a></li>                  
            	</ul>
				<span class="label bg-danger hidden-sm">装扮皮肤</span>
	        </div>
	        <div class="panel-body">
	        	
	        	<if condition="$login_user['space'] eq 1 "> 	        
		        <div class="tab-content">	
		        	<div id="space-bg" class="tab-pane fade active in">              		
	               		<div class="row image-box  mb-0">
	               			<foreach name="default_bg" item="vo" >
	                		<div class="col-md-4 col-sm-4 col-xs-6">                			
	                			<div class="item">
	                            	<div class="pos-rlt">
	                             		 <div class="item-overlay opacity r r-2x bg-black">
	                                		<div class="center text-center m-t-n">
	                                  		<a href="#" class="set-bg" data-url="<{$vo.imgurl}>"><i class="fa fa-check i-2x"></i></a>
	                                		</div>
	                              		</div>
	                              		<img class="r r-2x img-full" height="120"  alt="" src="<{$vo.thumburl}>">
	                            	</div>
	                              	<h5 class="text-ellipsis text-center" href="#"><{$vo.title}></h5>
	                          	</div>
	                        </div>
	                        </foreach>
		                </div>
	                </div>
				</div>	
				<else />
				<div class="text-center">
					<h4 class="m-title mt-10 mb-10 team">): 还没有开通空间！									
		             <a href="<{:U('Space/open',array('uid'=>UID))}>" class="button  btn-small green">点击开通</a>		
					</h4>
		         </div>
				</if>
				
			</div>
		</div>
	</div>
</div>

<script type="text/javascript">
	$(function ($) {
		$('.set-bg').click(function () {
			var imgurl = $(this).attr('data-url');
			$.post("<{:U('setbg')}>", {uid:'<{$login_user['uid']}>',bg:imgurl}, success, "json");  				
					
		})				
	})
	function success(data){
		if(data.status){
			if(data.url){
				infoAlert(data.info + ' 页面即将自动跳转!',true);
	           	setTimeout(function(){location.href=data.url;},1500);
	    	}else{
	    		infoAlert(data.info,true);
	    	}
		}else{
			infoAlert(data.info);				
		}
		
	}
</script>
</block>
